import java.io.File;
import java.io.IOException;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘远望
 * Date: 2025-06-07
 * Time: 15:30
 */

public class Demo1 {
    public static void main(String[] args) throws IOException {
//        File file = new File ("D:\\JavaEE\\java-ee-beginner\\test.txt");//绝对路径
        File file = new File("./test.txt");//相对路径,相对于当前项目目录

        System.out.println(file.getParent());//获得父目录
        System.out.println(file.getName());//获得文件名
        System.out.println(file.getPath());//获得文件路径(与上述构造方法路径相同)
        System.out.println(file.getAbsolutePath());//获得绝对路径
        System.out.println(file.getCanonicalPath());//获得规范路径(去除..等)

    }
}
